var tempObj = null;
var tempImg = null;
var bttObj = null;
var tempID = null;
var goodspage = 1;
var bradspage = 1;
try{
jQuery(function(){
	tempObj = document.getElementById("cate_brandT");
	tempImg = document.getElementById("img_brandT");
	bttObj = document.getElementById("btt_brandT");
	tempID = 'brandT';
})
}catch(e){}
function IndexDeploy(ID, type) {
	obj = document.getElementById("cate_" + ID);
	img = document.getElementById("img_" + ID);
	var btt;
	try{
		btt = document.getElementById("btt_" + ID);
	}catch(e){}
	if (obj.style.display == "none") {
		obj.style.display = "";
		img_re = new RegExp("_open\\.gif$");
		img.src = img.src.replace(img_re, '_fold.gif');
		if(type==1){
			btt.style.display = "none";	
		}
		if(null != tempObj&&tempObj!=obj&&type==1){
			bttObj.style.display = "";
			tempObj.style.display = "none";
			img_re = new RegExp("_fold\\.gif$");
			tempImg.src = img.src.replace(img_re, '_open.gif');
			if(type == 1){
					jQuery('#dddd_'+tempID).height(jQuery(bttObj).height()+2);
			}
		}
		tempObj = obj;
		tempImg = img;
		bttObj = btt;
		tempID = ID;
//		if(type==1){
//			window.location.hash = "tag_"+ID;	
//		}
		if(type == 1){
				parent.initIframeHeight(getHeight('cate_'+ID)+parseInt($("#hhh").val()));
				jQuery('#dddd_'+ID).height(jQuery(obj).height()+2);
		}
	} else {
		obj.style.display = "none";
		if(type==1){
			btt.style.display = "";	
		}
		img_re = new RegExp("_fold\\.gif$");
		img.src = img.src.replace(img_re, '_open.gif');
		if(type == 1){
				parent.initIframeHeight(getHeight('tagContent')+100)
				jQuery('#dddd_'+ID).height(jQuery(btt).height()+2);
		}
	}
	return false;
}

// -->

function pageHeight() {
	if (jQuery.browser.msie) {
		return document.compatMode == "CSS1Compat"
				? document.documentElement.clientHeight
				: document.body.clientHeight;
	} else {
		return self.innerHeight;
	}
};

function getHeight(id){
	return jQuery('#'+id).height();
}

function getPageHeight(){
	var documentHeight = 0;
	if(jQuery("body").innerHeight()>document.documentElement.clientHeight)
		documentHeight = jQuery("body").innerHeight();
	else
		documentHeight = document.documentElement.clientHeight;
	var documentWidth = 0;
	if(jQuery("body").innerWidth()>document.documentElement.clientWidth)
		documentWidth = jQuery("body").innerWidth();
	else
		documentWidth = document.documentElement.clientWidth;
	return documentHeight;
	
}

function good(id,flag){
       if(flag ==1&&goodspage == 1){
          alert("已是第一页");
          return;
       }
       if(flag ==1){
          goodspage = goodspage-1;
       }else{
          goodspage = goodspage+1;
       }
       var url =  "../brand/changeproductlist.shtml?id="+id+"&page="+goodspage;
        $.get(url,function(res){
        	if(res != 1){
        		var json = eval('('+res+')');
        	var str = "<ul id='goodsul'>";
        	for (var one in json)
			    {  
			      str +="<li><div class='px-tu1'><a target='_blank'  href='../brand/activityandcase.shtml?type=3&id="+json[one].id+"'><img src='"+basePath+json[one].imgSrc+"' width='204' height='226' /></a></div>"+
                  "<div class='px-tu2'><a target='_blank' href='../brand/activityandcase.shtml?type=3&id="+json[one].id+"'>"+json[one].name+"</a></div></li>";  
			    }
			  str+= " </ul>"
        	$("#goods").html(str);    
        	}else{
        	   alert("已到最后一页！");
        	  goodspage = goodspage-1;
        	}
        	 
        })
}

function brad(id,flag){
       if(flag ==1&&bradspage == 1){
          alert("已是第一页");
          return;
       }
       if(flag ==1){
          bradspage = bradspage-1;
       }else{
          bradspage = bradspage+1;
       }
       var url =  "../brand/changebradlist.shtml?id="+id+"&page="+bradspage;
        $.get(url,function(res){
        	if(res != 1){
        	var json = eval('('+res+')');
        	var str = "<ul>";
        	for (var one in json)
			    {  
			      str +="<li><div class='px1-tu1'><a target='_blank'  href='../brand/activityandcase.shtml?&type=2&id="+json[one].id+"'><img src='"+basePath+json[one].imgSrc+"' width='267' height='198' /></a></div>"+
                  "<div class='px1-tu2'><a target='_blank' href='../brand/activityandcase.shtml?&&type=2id="+json[one].id+"'>"+json[one].name+"</a></div></li>";  
			    }
			   str+= " </ul>"
        	  $("#brad").html(str); 
        	}else{
        	  alert("已到最后一页！");
        	  bradspage = bradspage-1;
        	}
        })
}
